﻿@model PagingDataSet<BlogThread>
@{
    BlogSearcher blogSearcher = (BlogSearcher)SearcherFactory.GetSearcher(BlogSearcher.CODE);
    string keyword = Request.QueryString.GetString("keyword", string.Empty);
    }
@if (Model.TotalRecords > 0)
{
  <input type="hidden" class="app-count" />
  <div class="tn-section tn-border-gray tn-border-bottom">
  <div class="tn-title tn-border-bottom tn-border-gray tnui-option" data-appname="Blog" data-search-url="@blogSearcher.PageSearchActionUrl(keyword)">
  <a href="@blogSearcher.PageSearchActionUrl(keyword)">搜“<span class="tn-text-bright">@keyword</span>”相关日志（@Model.TotalRecords）</a>
  </div>
  <ul class="tn-list" >
  @foreach (BlogThread blog in Model)
  {
      string barUrl = SiteUrls.Instance().BlogDetail(UserIdToUserNameDictionary.GetUserName(blog.UserId), blog.ThreadId);
  <li class="tn-list-item tnui-option" data-search-url="@barUrl" data-search-key="@blog.Subject">
    <div class="tn-list-item-area-main ">
        <div class="tn-list-item-row">
              <a title="@blog.Subject" href="@barUrl">
             @if (blog.Subject.Length > 13)
             {
                 @Html.Raw(SearchEngine.Highlight(keyword, HtmlUtility.TrimHtml(blog.Subject,13), 100))
             }
             else
             {
                 @Html.Raw(SearchEngine.Highlight(keyword, blog.Subject, 100))
             }
             </a>
        </div>
    </div>
    </li>
  }
  </ul>
  </div>
}